package com.li.service.Impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.li.DTO.BuildingManageDTO;
import com.li.VO.PageListVO;
import com.li.mapper.BuildingManageMapper;
import com.li.pojo.BuildingManage;
import com.li.service.BuildingManageService;
import com.li.util.BeanContent;
import com.li.util.ExcelPoi;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.List;

/**
 * @Author: zhiqingLi
 * @Description:
 * @Date: Created in 14:37 2024/3/13
 **/
@Service
public class BuildingManageServiceImpl implements BuildingManageService {

    @Autowired
    private BuildingManageMapper buildingManageMapper;

    @Override
    public PageListVO showList(BuildingManageDTO buildingManageDTO) {
        PageHelper.startPage(buildingManageDTO.getPageIndex(),buildingManageDTO.getPageSize());
        BuildingManage buildingManage = new BuildingManage();
        BeanUtils.copyProperties(buildingManageDTO,buildingManage);
        buildingManage.setCompanyId(BeanContent.getCurrentId());
        Page<BuildingManage> page = buildingManageMapper.showList(buildingManage);
        return new PageListVO(page.getTotal(),page.getResult());
    }

    @Override
    public void addSubregion(BuildingManage buildingManage) {
        buildingManage.setCompanyId(BeanContent.getCurrentId());
        buildingManage.setIsDel(0);
        buildingManageMapper.addSubregion(buildingManage);
    }

    @Override
    public BuildingManage updGetById(Long id) {
        return buildingManageMapper.updGetById(id);
    }

    @Override
    public void updSubregion(BuildingManage buildingManage) {
        buildingManageMapper.updSubregion(buildingManage);
    }

    @Override
    public void delById(Long id) {
        buildingManageMapper.delById(id);
    }

    @Override
    public List<String> showName() {
        return buildingManageMapper.showName();
    }

    @Override
    public List<Integer> showInter() {
        return buildingManageMapper.showInter();
    }
}
